/**
 * Created by dzd on 2017/3/24.
 */
(function () {
    'use strict';

    angular.module('App.pages.class')
        .controller('ClassActivityInfoCtrl', ClassActivityInfoCtrl);

    function ClassActivityInfoCtrl(activityId,$scope,$state,AppUtils,ClassActivityModel) {

        $scope.$on('$ionicView.beforeEnter', function (event, viewData) {
            viewData.enableBack = true;
        });

        var vm = this;
        vm.classActivity = {};
        vm.init = function(){
            if(!AppUtils.isUndefinedOrNull(activityId)){
                ClassActivityModel.findClassActivity({id: activityId}).$promise.then(function(response){
                    if(response.stat == 'err'){
                        AppUtils.showAlert(response.msg);
                    }else{
                        vm.classActivity = response.classActivity;
                    }
                })
            }else{
                AppUtils.showAlert("未找到该活动！");
                $state.go("classMenu.classActivity",activityId);
            }
        }
        vm.init();
    }
})();

